#include <iostream>
#include <string>
using namespace std;
#include "../NSocket.h"

using namespace std;
int main()
{
    CNSocket Sock;
    char     szBuffer[1024];
	Sock.NewSocket();
	printf("connect...\n");
	int iRet = Sock.Connect("127.0.0.1",8080);
	if(iRet == 1)
	{
        printf("...ok\n");
	}
	else
	{
	    printf("Error!\n");
	    return 0;
	}

    int iRecv = 0;
	while(1)
	{
	    printf("entry to send:\n");
        fgets(szBuffer,1024,stdin);
        Sock.Send(szBuffer,strlen(szBuffer));
        printf("send ok\n");
        iRecv = Sock.Recv(szBuffer,1024);
        szBuffer[iRecv] = '\0';
        printf("recv:%s\n",szBuffer);
    }
	return 0;
}
